/**
 * @param {number} num 生成颜色数组长度
 * @returns 颜色数组
 */
export const getColorArrByNum = (num) => {
  if (typeof num !== 'number') {
    if (isNaN(Number(num))) {
      num = 10
    } else {
      num = Number(num)
    }
  }
  num = (num > 0 && num <= 255) ? num : 10
  const arr = new Array(num)
  for (let i = 0; i < num; i++) {
    arr[i] = '#' + parseInt(i * 16777215 / num).toString(16).padStart(6, 0)
  }
  return arr
}